package com.code.mvc.controller;

import com.code.mvc.bean.User;
import com.code.mvc.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * mybatis源码分析测
 * 1.纯注解集成mybatis
 * 2.测试环境
 * @author wangjie
 * @version V1.0
 * @date 2020/1/20
 */
@Controller
public class UserController {

    @Autowired
    private UserDao userDao;

    @RequestMapping("/add")
    public String addUser(){

        User user = new User();
        user.setName("wj");
        user.setNick("jj");

        int add = userDao.add(user);

        if(add > 0){
            return "success";
        }
        return "fail";
    }
}
